package org.example.mulitithreading.ex1p;

public class MyThread1 extends Thread{
    @Override
    public void run() {
        while(true){
            synchronized (Money.lock){ // 同步在循环内，否则造成持续占用，死锁
                if(Money.money != 100000){
                    System.out.println("结婚基金已经不是十万了");
                    break;
                }
                System.out.println("detect");
            }
        }
    }
}
